package com.doudou.hystrix;

import com.doudou.hystrix.strategy.CustomHystrixConcurrencyStrategy;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 傻男人
 * @Date: 2020/5/25 11:28
 * @Version: 1.0
 * @Description: 线程隔离策略开启条件
 */
@Configuration
public class HystrixThreadIsolationAutoConfiguration {

    @Bean
    @ConditionalOnProperty(name = {
            "custom.hystrix.thread.isolate.enabled",
            "feign.hystrix.enabled"
    },havingValue = "true",matchIfMissing = false)
    public CustomHystrixConcurrencyStrategy springCloudHystrixConcurrencyStrategy() {
        return new CustomHystrixConcurrencyStrategy();
    }
}
